package org.zp.config;

import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.zp.interceptor.MyInterceptor;

@Configuration
public class WebConfig implements WebMvcConfigurer  {
	@Resource
	private MyInterceptor myInterceptor; 
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		// TODO Auto-generated method stub
		registry.addInterceptor(myInterceptor)
			.addPathPatterns("/*.act")
			.excludePathPatterns("/dologin.act")
			.excludePathPatterns("/static/**", "/public/**");
		// addPathPatterns:添加拦截的url
		// excludePathPatterns:某些url除外
		WebMvcConfigurer.super.addInterceptors(registry);
	}
}
